{% extends 'base.html' %}

{% load static %}

{% block title %}
    添加商品
{% endblock %}

{% block mycss %}
{% endblock %}

{% block content %}
     {% if msg %}
        <div class="alert alert-warning alert-dismissible fade show" role="alert">
            <strong>{{ msg }}</strong>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
    {% endif %}
    <form class="form-horizontal" method="post">
        {% csrf_token %}
        <div class="form-group row">
            <label for="inputEmail3" class="col-sm-3 row justify-content-end col-form-label">商品名称：</label>
            <div class="col-sm-4">
                <input type="text" class="offset-1 form-control" id="name" name="name"
                       placeholder="goods name">
            </div>
        </div>
        <div class="form-group row">
            <label for="inputEmail3" class="col-sm-3 row justify-content-end col-form-label">描述：</label>
            <div class="col-sm-4">
                <input type="text" class="offset-1 form-control" id="desc" name="desc" placeholder="description">
            </div>
        </div>
        <div class="form-group row">
            <label for="inputEmail3" class="col-sm-3 row justify-content-end col-form-label">价格：</label>
            <div class="col-sm-4">
                <input type="text" class="offset-1 form-control" id="price" name="price" placeholder="price">
            </div>
        </div>
        <div class="form-group row">
            <label for="inputEmail3" class="col-sm-3 row justify-content-end col-form-label">重量：</label>
            <div class="col-sm-4">
                <input type="text" class="offset-1 form-control" id="weighte" name="weight" placeholder="weighte">
            </div>
        </div>
        <div class="form-group row">
            <label for="inputEmail3" class="col-sm-3 row justify-content-end col-form-label">类别：</label>
            <div class="col-sm-4">
                <select id="type" name="type" class="offset-1 custom-select is-invalid" id="validationServer04"
                        aria-describedby="validationServer04Feedback" required>
                    {% for type in types %}
                        <!--  显示类别名称，传输类别id  -->
                        <option value="{{ type.id }}">{{ type.tname }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>
        <div class="form-group form-check offset-4">
            <input type="checkbox" class="offset-1 form-check-input" id="is_delete" name="is_delete"
                    {% if user.is_delete == 1 %}
                   checked
                    {% endif %} >
            <label class="form-check-label" for="exampleCheck1">用户是否删除</label>
        </div>
        <div class="form-group row">
            <div class="offset-4 col-sm-10">
                <button type="submit" class="btn btn-primary" id="btn_update">添加商品</button>
            </div>
        </div>
    </form>
{% endblock %}